function LibraryInfo_Code() {
	var buffer = new StringBuffer();
	buffer.append('<div class="orderinfo"><div class="line100"><font class="blacks">仓库编号：</font><font id="num">加载中...</font></div><div class="line100"><font class="blacks">仓库名称：</font><font id="name"></font></div><div class="line100"><font class="blacks">仓库地址：</font><font id="address"></font></div><div class="line100"><font class="blacks">仓库管理员：</font><font id="manager"></font></div><div class="line100"><font class="blacks">联系电话：</font><font id="mobile"></font></div><div class="line100"><font class="blacks">创建时间：</font><font id="createdate"></font></div><div class="line100"><font class="blacks">备注：</font><font id="bak"></font></div></div>');
	return buffer.toString();
};


function Init_LibraryDetail(){
	var data = {};
    data.act = "One_Library";
    data.id = obj.attr("id");
    data.userid=userid;
	data.comid=comid;
	data.source=source;
	data.sign=GetSign(data.act);
    mui.getJSON(crm_domain, data, function(json) {
    	var library = json.data;
    	var str="";
        //var tags = json.data.tags;
        $("#num").html(library.Num);
        $("#name").html(library.Name);
        $("#address").html(library.Address.ToString());
        $("#manager").html(library.Manager.ToString());
        $("#mobile").html(library.Mobile.ToString());
        $("#bak").html(library.Bak.ToString());
        $("#createdate").html(library.CreateDate);     
    });
};


function LibraryTool()
{
	if($("#librarytool").length>0)
	{
		$("#librarytool").show();
	}else
	{
		$("body").append('<div id="librarytool" class="customertool" style="height:120px;"><ul><li id="libraryedit">修改仓库</li><li id="librarydelete">删除仓库</li></ul></div>');
		//初始化工具条
		get("libraryedit").addEventListener("tap",function(){
        	OpenWindow(3,"仓库","保存",function(){
				Save_Library();
			});
			$("#contentlist3").html(LibraryAdd_Code(obj.attr("id")));
			Init_LibraryAdd();
			$("#librarytool").hide();
        });
        
        get("librarydelete").addEventListener("tap",function(){
        	$("#librarytool").hide(); 
        	plus.nativeUI.confirm("确定要删除吗？", function(event){
				if(event.index==1)
				{
					var data = {};
				    data.act = "Delete_Library";
				    data.ids = obj.attr("id");
				    data.userid=userid;
					data.comid=comid;
					data.source=source;
					data.sign=GetSign(data.act);
				    mui.getJSON(crm_domain, data, function(json) {
				    	plus.nativeUI.toast(json.msg);
						if(json.state)
						{
							CloseWindow();
							obj.remove();
						}
				    });	
				}
			},"提示", ["取消","确认"]); 
        });
	}
};
